package com.zz.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import nonapi.io.github.classgraph.json.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import javax.annotation.Nullable;
import javax.validation.constraints.Future;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * 投稿箱
 * @author zhouzi
 */
@Data
@Document(indexName = "box")
@ApiModel("投稿箱")
public class ESBox implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @Field(type = FieldType.Text)
    @ApiModelProperty("主键")
    @TableId(type= IdType.AUTO)//主键自增
    @Nullable
    private Long id;

    //建议社团编码
    @Field(type=FieldType.Text,index=false)
    @ApiModelProperty("建议社团编码")
    @NotNull(message = "建议社团编码不能为空")
    private Long clubId;

    //活动主题
    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    @ApiModelProperty("活动主题")
    @NotNull(message = "活动主题不能为空")
    private String theme;

    //活动方式
    @Field(type=FieldType.Text,index=false)
    @ApiModelProperty("活动方式")
    @NotNull(message = "活动方式不能为空")
    private String mode;

    //活动时间
    @Field(type = FieldType.Date,format = DateFormat.basic_date_time)
    //@Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    //@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @ApiModelProperty("活动时间")
    @NotNull(message = "活动时间不能为空")
    //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @Future
    private Date time;

    //活动地点
    @Field(type=FieldType.Text,index=false)
    @ApiModelProperty("活动地点")
    @NotNull(message = "活动地点不能为空")
    private String place;

    //建议
    @Field(type=FieldType.Text,index=false)
    @ApiModelProperty("建议")
    @Nullable
    private String advice;
}
